import re

class FormatText:
    """This class transforms pure text to a more readable format."""
    
    def __init__(self, text):
        self.lineEnders = "[.?!\n]+ *" # this regex specifies when a sentence ends
        self.text = text
        self.longString = "".join(self.text)
        
    def getSentences(self):
        """Returns a sequence of sentences"""    
        r = re.compile(self.lineEnders)
        sentences = r.split(self.longString)
        return sentences
    
    def getNormalSentences(self):
        """ TODO: Under Construction
            Returns the same sentences as method getSentences, but removes in-line parenthesis
            E.g. : 
                    Anna Mae Bullock, better known by 
                    her stage name Tina Turner (born November 26, 1939) 
                    is an American singer, dancer and entertainer
            would be returned as:
                    Anna Mae Bullock, better known by 
                    her stage name Tina Turner 
                    is an American singer, dancer and entertainer
        """
        r = re.compile(self.lineEnders)
        sentences = r.split(self.longString)
        #function = 
        #map(function, sentences) # remove inline parenthesis
        return sentences
    
    def __removeInlineParenthesis(self, sentence):
        """
            TODO:
            Currently not implemented, a stackbased parser is needed because of nested expression.
        """
        inlineSymbols = "[.]+"
        r = re.compile(self.inlineSymbols)  